package com.ruoyi.control.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.control.mapper.UseElectricityMapper;
import com.ruoyi.control.domain.UseElectricity;
import com.ruoyi.control.service.IUseElectricityService;

/**
 * 智能用电Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-18
 */
@Service
public class UseElectricityServiceImpl implements IUseElectricityService
{
    @Autowired
    private UseElectricityMapper useElectricityMapper;

    /**
     * 查询智能用电
     *
     * @param tagName 智能用电主键
     * @return 智能用电
     */
    @Override
    public UseElectricity selectUseElectricityByTagName(String tagName)
    {
        return useElectricityMapper.selectUseElectricityByTagName(tagName);
    }

    /**
     * 查询智能用电列表
     *
     * @param useElectricity 智能用电
     * @return 智能用电
     */
    @Override
    public List<UseElectricity> selectUseElectricityList(UseElectricity useElectricity)
    {
        return useElectricityMapper.selectUseElectricityList(useElectricity);
    }

    /**
     * 新增智能用电
     *
     * @param useElectricity 智能用电
     * @return 结果
     */
    @Override
    public int insertUseElectricity(UseElectricity useElectricity)
    {
        return useElectricityMapper.insertUseElectricity(useElectricity);
    }

    /**
     * 修改智能用电
     *
     * @param useElectricity 智能用电
     * @return 结果
     */
    @Override
    public int updateUseElectricity(UseElectricity useElectricity)
    {
        useElectricity.setUpdateTime(DateUtils.getNowDate());
        return useElectricityMapper.updateUseElectricity(useElectricity);
    }

    /**
     * 批量删除智能用电
     *
     * @param tagNames 需要删除的智能用电主键
     * @return 结果
     */
    @Override
    public int deleteUseElectricityByTagNames(String[] tagNames)
    {
        return useElectricityMapper.deleteUseElectricityByTagNames(tagNames);
    }

    /**
     * 删除智能用电信息
     *
     * @param tagName 智能用电主键
     * @return 结果
     */
    @Override
    public int deleteUseElectricityByTagName(String tagName)
    {
        return useElectricityMapper.deleteUseElectricityByTagName(tagName);
    }
}
